package bishi360;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by JiaJia on 2019/8/31 0031.
 */
public class WalkingStart {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int n=scanner.nextInt();
            int m=scanner.nextInt();
            int[] arr=new int[m];
            for (int i=0;i<m;i++){
                arr[i]=scanner.nextInt();
            }
            System.out.println(startCount(n,m,arr));
        }
        scanner.close();
    }
    private static int startCount(int n,int m,int[] arr){
        int result=0;
        for (int i = 0; i <=n ; i++) {
            int tmp=i;
            for (int j = 0; j <m ; j++) {
                if (arr[j]>=n || arr[j]<0){
                    break;
                }
                if (tmp+arr[j]<=n){
                    tmp+=arr[j];
                }else if (tmp-arr[j]>=1){
                    tmp-=arr[j];
                }else {
                    tmp=0;
                    break;
                }
            }
            if (tmp>=1&&tmp<=n){
                result++;
            }
        }
        return result;
    }
    /*private static int startCount(int n,int m,int[] arr){
        List<Integer> list=new ArrayList<>();
        for (int i = 0; i <n ; i++) {
            backtracking(n,1,m,arr,1,0);
        }
    }
    private static void backtracking(int n,int start,int m,int[] arr,int sum,int sindex){
        if (sum<1 || sum>n){
            return;
        }
        if (sindex==m-1){

        }


    }*/
}